<script type="text/javascript">
$(function(){
	$('select[name=group_id]').change(function(){
		if($(this).val()==5)
		{
			$('.group').hide();
		}
		else
		{
			$('.group').show();
		}
	})	
	
	
	if($('select[name=group_id] option:selected').val()==5)
	{
		$('.group').hide();
	}
	else
	{
		$('.group').show();
	}
})
</script>
<h1><?php echo $category->name; ?></h1>
<?php echo form_open_multipart('boards/admin/boards/save/'.$content->id.'/?agency_id='.$_GET['agency_id']); ?>
<table class="form">
	<tr>
		<th>รูป</th>
		<td>
			<?php if(is_file('uploads/board/'.$content->image)): ?>
			<?php echo anchor('boards/admin/boards/delete_img/'.$content->id.'/?agency_id='.$_GET['agency_id'],'x','class="btn"').br() ?>
			<?php echo img('uploads/board/'.$content->image).br()  ?>
			<?php else: ?>
			<?php echo img('themes/default/images/img.jpg').br() ?>
			<?php endif; ?>
			<?php echo form_upload('image'); ?>
		</td>
	</tr>
	<tr>
		<th>กลุ่ม</th>
		<td><?php echo form_dropdown('group_id', option(new Group, 'id', 'name'), $content->group_id); ?></td>
	</tr>
	<tr class="group" >
		<th>บรรทัด</th>
		<td><input type="text" name="row" value="<?php echo $content->row ?>" /></td>
	</tr>
	<tr>
		<th>ลำดับ</th>
		<td><input type="text" name="col" value="<?php echo $content->col ?>" /></td>
	</tr>
	<tr>
		<th>ชื่อ</th>
		<td><?php echo form_input('firstname', $content->firstname); ?></td>
	</tr>
	<tr>
		<th>นามสกุล</th>
		<td><?php echo form_input('lastname', $content->lastname); ?></td>
	</tr>
	<tr>
		<th>ตำแหน่ง</th>
		<td><?php echo form_input('position', $content->position); ?></td>
	</tr>
	<tr class="group" >
		<th>โทรศัพท์</th>
		<td><?php echo form_input('telephone', $content->telephone); ?></td>
	</tr>
	<tr class="group" >
		<th>มือถือ</th>
		<td><?php echo form_input('mobile', $content->mobile); ?></td>
	</tr>
	<tr class="group" >
		<th>โทรสาร</th>
		<td><?php echo form_input('fax', $content->fax); ?></td>
	</tr>
	<tr class="group" >
		<th>อีเมล์</th>
		<td><?php echo form_input('email', $content->email); ?></td>
	</tr>
	<tr>
		<th>ปีงบประมาณที่เริ่ม</th>
		<td>
			<?php echo form_dropdown('year_start',array_combine(range(2500,date('Y')+543),range(2500,date('Y')+543)),$content->year_start,'style="width:70px;"') ?>
		</td>
	</tr>
	<tr>
		<th>ปีงบประมาณที่สิ้นสุด</th>
		<td>
			<?php echo form_dropdown('year_end',array_combine(range(2500,date('Y')+543),range(2500,date('Y')+543)),$content->year_end,'style="width:70px;"','ปัจจุบัน') ?>
		</td>
	</tr>
	<tr class="group" >
		<th>เขตตรวจ</th>
		<td><?php echo form_textarea('area', $content->area, 'style="width:500px;height:100px;"'); ?></td>
	</tr>
	<tr>	
		<th></th>
		<td>
			<?php echo form_submit('',lang('btn_submit'),'class="button"')?>
			<?php echo form_button('',lang('btn_back'),'class="button" onclick="window.location = \'boards/admin/boards?agency_id='.$_GET['agency_id'].'\'"')?>
		</td>
	</tr>
</table>
<?php echo form_hidden('category_id', $category->id); ?>
<?php form_close(); ?>